package com.example.springbootyczy.intercepter;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册器开始执行
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                //如果放行该请求链接，则不会进入到拦截器当中，就不会有放行一说
                .excludePathPatterns("/login","/log","/")
                .order(1);
    }
}
